package com.zzq.my.jetpacks.jectpackapp.ui.stickyheaderrecyclerview;

import android.view.View;
import android.widget.TextView;

import com.zzq.my.jetpacks.jectpackapp.R;

import tellh.com.stickyheaderview_rv.adapter.StickyHeaderViewAdapter;
import tellh.com.stickyheaderview_rv.adapter.ViewBinder;

public class ItemViewBinder extends ViewBinder<Item, ItemViewBinder.ViewHolder> {
    @Override
    public ViewHolder provideViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }
    @Override
    public void bindView(StickyHeaderViewAdapter adapter, ViewHolder holder, int position, Item entity) {
        holder.tv_title.setText(entity.title);
        holder.tv_message.setText(entity.message);
    }
    @Override
    public int getItemLayoutId(StickyHeaderViewAdapter adapter) {
        return R.layout.item_view;
    }
    static class ViewHolder extends ViewBinder.ViewHolder {
        TextView tv_message;
        TextView tv_title;
        public ViewHolder(View rootView) {
            super(rootView);
            this.tv_title = (TextView) rootView.findViewById(R.id.tv_title);
            this.tv_message = (TextView) rootView.findViewById(R.id.tv_message);
        }
    }
}